/*
 * @Description:组合继承
 * @Author: admin
 * @Date: 2021-06-08 18:02:00
 * @LastEditors: admin
 * @LastEditTime: 2021-06-08 18:07:49
 */
function Animal (name, age) {
  this.name = name;
  this.age = age;
}
Animal.prototype = {
  constructor: Animal,
  sayHello: function () {
    console.log(this.name + "hello!");
  }
}
function Dog (name, age, color) {
  //经典继承
  Animal.call(this, name, age);
  this.color = color;
}
// 原型链继承
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog;
Dog.prototype.sayColor = function () {
  console.log(this.color);
};

var dog = new Dog("🐶", 1, "yellow");
console.log(dog);
dog.sayHello();
dog.sayColor();